package physicshandler;

import java.awt.*;
import java.util.*;

import physicshandler.*;

public class BasicShape 
{
	
	private String typeOfShape;
	Vector dxLoc = new Vector(100, 100), dyLoc = new Vector(200, 100);
	private int positionX, positionY, sizeX, sizeY, diameter, dx = 0, dy = 0;
	PhysXProcessor physics;
	Runnable run;

	public BasicShape(String typeOfShape, int positionX, int positionY, int diameter, Vector initialSpeed) 
	{
		this.typeOfShape = typeOfShape;
		this.positionX   = positionX;
		this.positionY   = positionY;
		this.diameter       = diameter;
		physics = new PhysXProcessor(positionX, positionY, diameter);
		physics.setDx(initialSpeed.getX_coordinate());
		physics.setDy(initialSpeed.getY_coordinate());
	}
	

	

	public void Draw(Graphics2D graphics)
	{

		if (typeOfShape.equals("Circle"))
		{

			if(physics.isDeadItem()) 
			{
				graphics.drawOval(physics.getPositionX(), physics.getPositionY(), diameter, diameter);
				graphics.fillOval(physics.getPositionX(), physics.getPositionY(), diameter, diameter);
			}
			else
			{
				graphics.drawOval(physics.getPositionX(), physics.getPositionY(), diameter, diameter);
				graphics.fillOval(physics.getPositionX(), physics.getPositionY(), diameter, diameter);
				graphics.drawString("dy: " + physics.getDy(),            physics.getPositionX(), physics.getPositionY() - 30);
				graphics.drawString("dx: " + Math.round(physics.getDx()),physics.getPositionX() - 50, physics.getPositionY() - 30);

			}
				
		}
		
		

	}
	
	public void specificAnimation()
	{
		
		physics.setGravity(true);
		physics.handleEvents();
		
	
	}




	public static boolean testDeath(BasicShape item) 
	{
		// TODO Auto-generated method stub
		if (item.physics.isDeadItem())
			return true;
		else
			return false;
		
	}
	

}
